package com.duohe.demo.entity;

import com.duohe.demo.MyCustomConstranint;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;
import javax.validation.constraints.*;
@Data
public class User implements Serializable {
    /**
    *主键id
     * */
    private Long id;

    @NotBlank(message = "用户明不能为空")
    @Length(min = 4,max = 20,message = "用户名长度为5-20个字符")
    private String name;

    @NotNull(message = "年龄不能为空")
    @Min(value = 18,message = "最小不能低于18岁")
    @Max(value = 60,message = "最大不能超过60岁")
    private Integer age;

    @Email(message = "请输入邮箱")
    @NotBlank(message = "邮箱不能为空")
    private String email;

    @MyCustomConstranint
    private String answer;
}
